import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/mes-product/qms-inspection-document/page?statusStr=1,4',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

// 撤销
export const revoke = (data) => {
  return request({
    url: '/api/mes-product/qms-inspection-document/document-revoke',
    method: 'POST',
    data
  });
};

// 处理
export const handle = (data) => {
  return request({
    url: '/api/mes-product/qms-inspection-document/submit-result',
    method: 'POST',
    data
  });
};

export const getLineList = () => {
  return request({
    url: '/api/mes-product/productionline/list-by-valid',
    method: 'get'
  });
};

export const getWorkOrderDetail = (workOrderNo, documentType) => {
  return request({
    url: '/api/mes-product/qms-inspection-document/search-work-order',
    method: 'get',
    params: {
      workOrderNo,
      documentType
    }
  });
};

//根据发货单查物料
export const getMaterialByDelivery = (sheetNo) => {
  return request({
    url: '/api/mes-product/qms-inspection-document/search-sheet-header?documentType=OQC',
    method: 'get',
    params: {
      sheetNo
    }
  });
};

export const add = (data) => {
  return request({
    url: '/api/mes-product/qms-inspection-document/submit',
    method: 'post',
    data: data
  });
};

export const getDetail = (id) => {
  return request({
    url: '/api/mes-product/qms-inspection-document/detail-by-id',
    method: 'get',
    params: {
      id
    }
  });
};

//加急
export const urgent = (params) => {
  return request({
    url: '/api/mes-product/qms-inspection-document/update-urgent',
    method: 'get',
    params
  });
};

// 获取巡检时段
export const getInspectionPeriod = () => {
  return request({
    url: '/api/mes-product/qms-ipqc-timeframe/list',
    method: 'get'
  });
};

export const getLineListByWorkOrder = (params) => {
  return request({
    url: '/api/mes-product/productionline/list-Work-order',
    method: 'get',
    params
  });
};

// 处理保存草稿
